package com.cjh.wechat.websocket.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cjh.wechat.commom.pojo.User;
import com.cjh.wechat.websocket.service.UserService;

@Controller
@RequestMapping("/account")
public class AccountController
{
    @Resource
    private UserService userService;
    
    @ResponseBody
    @RequestMapping(value = "/addSession", method = RequestMethod.POST)
    private String addSession(String id, HttpSession session)
    {
        User user = userService.findById(id);
        session.setAttribute("USERINFO", user);
        return "success";
    }
}
